package org.example.config;

import jakarta.annotation.Resource;
import org.example.interceptor.Firstinterceptor;
import org.example.interceptor.Fourthinterceptor;
import org.example.interceptor.Secondinterceptor;
import org.example.interceptor.Thirdinterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Auther:Liu
 * @Testname:SpringMvcConfig
 * @Date:2025/7/31 9:55
 */
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
    @Resource
    private Firstinterceptor firstinterceptor;
    @Resource
    private Secondinterceptor secondinterceptor;
    @Resource
    private Thirdinterceptor thirdinterceptor;
    @Resource
    private Fourthinterceptor fourthinterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(firstinterceptor).addPathPatterns("/first/**")
        .excludePathPatterns("/a").order(1);

        registry.addInterceptor(secondinterceptor).addPathPatterns("/first/**").excludePathPatterns("/a").order(2);
        registry.addInterceptor(thirdinterceptor).addPathPatterns("/first/**").excludePathPatterns("/a").order(3);
        registry.addInterceptor(fourthinterceptor).addPathPatterns("/first/**").excludePathPatterns("/a").order(4);
    }


}
